package com.example.testlog4j;

import java.io.File;

import org.apache.log4j.Level;

import android.app.Application;
import android.os.Environment;
import de.mindpipe.android.logging.log4j.LogConfigurator;

public class MyApp extends Application {
	@Override
	public void onCreate() {
		super.onCreate();
		//https://code.google.com/p/android-logging-log4j/
		final LogConfigurator logConfigurator = new LogConfigurator();

		logConfigurator.setFileName(Environment.getExternalStorageDirectory()
				+ File.separator + "/a/myapp.log");
		logConfigurator.setRootLevel(Level.DEBUG);
		logConfigurator.setLevel("org.apache", Level.ERROR);
		logConfigurator.setMaxFileSize(1000 * 10);
		logConfigurator.setUseLogCatAppender(false);
		logConfigurator.configure();

		//		LogConfigurator logConfigurator = new LogConfigurator();
		//
		//		logConfigurator.setFileName(Environment.getExternalStorageDirectory()
		//				+ File.separator + "MyApp" + File.separator + "logs"
		//
		//				+ File.separator + "log4j.txt");
		//
		//		logConfigurator.setRootLevel(Level.DEBUG);
		//
		//		logConfigurator.setLevel("org.apache", Level.ERROR);
		//
		//		//		logConfigurator.setFilePattern("%d %-5p [%c{2}]-[%L] %m%n");
		//
		//		logConfigurator.setMaxFileSize(4 * 4 * 5);
		//
		//		logConfigurator.setImmediateFlush(true);
		//
		//		logConfigurator.configure();
		//
		//		Logger log = Logger.getLogger(MyApp.class);
		//		log.info("My Application Created");
	}
}
